<?php    
    require_once WURFL_DIR . 'Application.php';
    class sscls_WURFL
    {
        public function getRequestingDevice($server)
        {
            $persistenceDir = RESOURCES_DIR . 'storage/persistence';
            $cacheDir = RESOURCES_DIR . "storage/cache";
            $wurflConfig = new WURFL_Configuration_InMemoryConfig ();
            $wurflConfig
                ->wurflFile(RESOURCES_DIR . 'wurfl.xml')
                ->wurflPatch(RESOURCES_DIR . 'web_browsers_patch.xml')
                ->persistence("file",array(
                                    WURFL_Configuration_Config::DIR => $persistenceDir))
                ->cache("file", array(
                                WURFL_Configuration_Config::DIR => $cacheDir,
                                WURFL_Configuration_Config::EXPIRATION => 36000));
            $wurflManagerFactory = new WURFL_WURFLManagerFactory($wurflConfig);
            $wurflManager = $wurflManagerFactory->create();            
            $requestingDevice = $wurflManager->getDeviceForHttpRequest($server);
            return $requestingDevice;    
        }           
    }
?>
